package Class.PredefinedClass;
import java.time.*;

/**
 * Enjoy programming!!!
 * Time: 2021/10/29 -  14:41
 */
public class PredefinedClass01 {
    public static void main(String[] args){
        LocalDate date = LocalDate.now();
        int month = date.getMonthValue();
        int today = date.getDayOfMonth();

        date = date.minusDays(today - 1);//Set to start of month，minusDays方法减去.前面对象的()天数
        DayOfWeek weekday = date.getDayOfWeek();
        int value = weekday.getValue();//1 = Monday, ... 7 = Sunday

        System.out.println("Mon Tue Wed Thu Fru Sat Sun");
        for (int i = 1; i < value; i++)
            System.out.print("    ");
        while (date.getMonthValue() == month){
            System.out.printf("%3d", date.getDayOfMonth());
            if (date.getDayOfMonth() == today)
                System.out.print("*");
            else
                System.out.print(" ");
            date = date.plusDays(1);
            if (date.getDayOfWeek().getValue() == 1) System.out.println();
        }
        if (date.getDayOfWeek().getValue() != 1) System.out.println();
    }
}
